#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
const int N = 6;
int maze[N][N] = {
  {4,4,2,2,2,5},
  {5,1,2,3,1,2},
  {3,3,3,2,3,4},
  {2,1,2,2,3,5},
  {3,3,3,3,4,1},
  {4,3,5,2,5,0}
};
bool visited[N][N];
vector<pi> paths;
void success() {
  paths.push_back({N-1,N-1});
  cout << "Found Path: ";
  for(auto [x,y]:paths) {
    // cout << x << "," << y << "->";
    cout<<"("<<x<<","<<y<<")"<<" ";
  }
  cout << endl;
  paths.pop_back();
}
void backtrack(int x,int y) {
  if(visited[x][y]) return;
  int dist = maze[x][y];
  if(dist == 0) {
    success();
    return;
  }

  visited[x][y] = true;
  paths.push_back({x,y});
  if(x+dist < N) backtrack(x+dist, y);
  if(y+dist < N) backtrack(x, y+dist);
  if(x-dist >= 0) backtrack(x-dist, y);
  if(y-dist >= 0) backtrack(x, y-dist);

  visited[x][y] = false;
  paths.pop_back();
  return;
}
int solve() {
  backtrack(0,0);
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  // freopen("in.txt","r",stdin);
  // freopen("out.txt","w",stdout);
  int tc; tc = 1;
  for(int t = 1; t <= tc; t++) {
    // cout << "Case #" << t << ": "
    solve();
  }
  return 0;
}
